<?php


namespace App\Controller;

use App\Model\HyClient;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\AutoController;
use Hyperf\View\RenderInterface;
use function Hyperf\ViewEngine\view;

/**
 * Class TestController
 * @package App\Controller
 * @AutoController()
 */
class TestController extends AbstractController
{
    /**
     * @Inject()
     * @var RenderInterface
     */
    public $render;
    public function test1()
    {
        return [
            "mag"=>(new \TestHelper())->appName()
        ];
    }

    public function test2()
    {
        // 测试with在多个服务器的情况
        
        return  HyClient::query()->with('clientLabel')->get();
        
    }


    public function test3()
    {
        // 测试left join 跨服务器

        return  HyClient::query()
            ->leftJoin('client_label','id','=','id')
            ->get();

    }

    public function test4()
    {
        // 模板引擎测试

        $res = view('{{ $name }}',['name'=>"测试"]);
        
        
        
        var_dump($res);
    }
    
}